public class Main {
    public static int func(String ss){
        //字符串变数组
        char[] s = ss.toCharArray();
        //模拟hash表
        int[] hash = new int[128];
        int left = 0;
        int right = 0;
        int ret = 0;

        while(right < ss.length()){
            //入窗帘
            hash[s[right]]++;
            //判断
            while(hash[s[right]] > 1){
                //出窗口
                hash[s[left++]]--;
            }
            //更新长度
            ret = Math.max(ret,right-left+1);
            right++;
        }
        return ret;
    }
    public static void main(String[] args) {

        System.out.println(func("bbbbb"));
    }
}